package net.expectx.micro.shop.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import net.expectx.common.single.util.MonitorCurrentSystemUtil;
import net.expectx.common.single.util.formatter.MessageFormatter;
import net.expectx.micro.shop.common.BaseController;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;


/**
 * 后台controller
 * @author jianhun
 * @date 2018/5/17
 */
@Controller
@RequestMapping("/manager/")
@Api(value = "后台管理", description = "后台管理")
public class ManagerController extends BaseController {

    private static final Logger LOGGER = Logger.getLogger(ManagerController.class);



	@ApiOperation(value = "后台首页")
	@RequestMapping(value = "index", method = RequestMethod.GET)
	public ModelAndView index(ModelMap modelMap) {
        LOGGER.info(MessageFormatter.format("-----------------------{}-------------------------------","进入首页"));
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.setViewName("index");
		return modelAndView;

	}
	@ApiOperation(value = "后台欢迎页")
	@RequestMapping(value = "console", method = RequestMethod.GET)
	public String welcome(ModelMap modelMap){

		return "console";
	}
    @RequestMapping(value = "/monitorCurrentSystem", method = RequestMethod.GET)
    @ResponseBody
    public Object monitorCurrentSystem(){
        MonitorCurrentSystemUtil service = new MonitorCurrentSystemUtil();
        MonitorCurrentSystemUtil.MonitorCurrentSystemInfo monitorInfo = service.getMonitorCurrentSystemInfo();
	    return monitorInfo;
    }

}
